<?php
function https_request($url)
{
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  $data = curl_exec($curl);
  if (curl_errno($curl)) {return 'ERROR '.curl_error($curl);}
  curl_close($curl);
  return $data;
}
  $code = $_GET['code'];
  echo $code."<br>";
  $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxb89990bbfaeb09a5&secret=acf5bf81745db10178789d468b8a2b7d&code=".$code."&grant_type=authorization_code";
$data = https_request($url);
var_dump($data);
?>
